<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="ja"> 
 
<!-- ==== document header ==== --> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<meta http-equiv="Content-Style-Type" content="text/css"> 
<meta http-equiv="Content-Script-Type" content="text/javascript"> 
<title>Running Projects</title> 
</head><?php
 $db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
 mysql_select_db("JRtu434", $db);
 $sql = "select * from testredirect";
 $result = mysql_query("Select name as name,sum(if(status=\"complete\",1,0)) as complete,sum(if(status=\"screenout\",1,0)) as screenout, sum(if(status=\"quotafull\",1,0)) as quotafull
 , sum(if(status=\"short\",1,0)) as short, sum(if(status=\"gate\",1,0)) as gate, sum(if(status is null,1,0)) as empty from testredirect,projects where testredirect.rid=projects.rid group by name");
 
 echo "<table border='1'>";
 echo "<td>" . "Name". "</td>";
 echo "<td>" ."Complete". "</td>";
 echo "<td>" ."Screenout" . "</td>";
 echo "<td>" ."Quotafull" . "</td>";
 echo "<td>" ."Short" . "</td>";
 echo "<td>" ."Gate" . "</td>";
 echo "<td>" ."In Progress" . "</td>";
while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['name'] . "&nbsp;&nbsp;&nbsp;</td>";
  echo "<td>" . $row['complete'] . "</td>";
  echo "<td>" . $row['screenout'] . "</td>";
  echo "<td>" . $row['quotafull'] . "</td>";
  echo "<td>" . $row['short'] . "</td>";
  echo "<td>" . $row['gate'] . "</td>";
  echo "<td>" . $row['empty'] . "</td>";
  echo "</tr>";
  }
  echo "</table>";

 mysql_close();
?></html>
